#include file
cppRepFolder = ../SQL_cpp_representation/
formulaRepFolder = ../../Formula_representation/
minizincFolder = ../../MiniZinc/

all: release

release: SQL_grammar

debug: SQL_grammar_debug

SQL_grammar:  SQLgrammarFiles makeCppRepresentation makeFormulaRepresentation makeMiniZinc
	g++ -I$(cppRepFolder) -I$(formulaRepFolder) -I$(minizincFolder) -I/usr/local/include -L/usr/local/lib $(cppRepFolder)*.o $(formulaRepFolder)*.o  $(minizincFolder)*.o lex.yy.c y.tab.c -lfl -c -DYYDEBUG=0

SQL_grammar_debug:  SQLgrammarFilesDebug makeCppRepresentationDebug makeFormulaRepresentationDebug makeMiniZincDebug
	g++ -g -I$(cppRepFolder) -I$(formulaRepFolder) -I$(minizincFolder) -I/usr/local/include -L/usr/local/lib $(cppRepFolder)*.o $(formulaRepFolder)*.o $(minizincFolder)*.o lex.yy.c y.tab.c -lfl -c -DYYDEBUG=1

SQLgrammarFiles: SQL.y SQL.l
	bison -dy SQL.y
	flex SQL.l

makeCppRepresentation:
	cd $(cppRepFolder); make

makeFormulaRepresentation:
	cd $(formulaRepFolder); make

makeMiniZinc:
	cd $(minizincFolder); make

makeCppRepresentationDebug:
	cd $(cppRepFolder); make debug

makeFormulaRepresentationDebug:
	cd $(formulaRepFolder); make debug

makeMiniZincDebug:
	cd $(minizincFolder); make debug

SQLgrammarFilesDebug: SQL.y SQL.l
	bison --debug -v -dy SQL.y
	flex -d SQL.l

clean:
	cd $(cppRepFolder); make clean
	cd $(formulaRepFolder); make clean

